package com.example.controller;

import com.github.yitter.idgen.YitIdHelper;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * packageName com.example.controller
 *
 * @author chenjie
 * @version JDK 8
 * @className IdController (此处以class为例)
 * @date 2024/7/3
 * @description TODO
 */
@RestController
public class IdController {

    @GetMapping("/id")
    public ResponseEntity<String> id() {
// 初始化后，在任何需要生成ID的地方，调用以下方法：
        Long newId = YitIdHelper.nextId();
        return ResponseEntity.ok(newId.toString());
    }
}
